<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>红酒管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../../static/css/font.css" th:href="@{/css/font.css}">
    <link rel="stylesheet" href="../../static/css/xadmin.css" th:href="@{/css/xadmin.css}">
    <script src="../../static/lib/layui/layui.js" th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/xadmin.js" th:src="@{/js/xadmin.js}"></script>
</head>

<body>
<!-- 顶部开始 -->
<div th:replace="~{common/common::top}"></div>
<!-- 顶部结束 -->
<!-- 左侧菜单开始 -->
<div th:replace="~{common/common::side}"></div>
<!-- 左侧菜单结束 -->
<div class="page-content">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">

                    <div class="layui-card-header">
                        <a class="layui-btn" th:href="@{/admin/toAdd}">
                            <i class="layui-icon"></i>添加</a></div>
                    <div class="layui-card-body">
                    <div class="layui-table">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>登录名</th>
                                <th>手机</th>
                                <th>邮箱</th>
                                <th>角色</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="admin:${adminPage.list}">
                                <td th:text="${admin.getId()}"></td>
                                <td th:text="${admin.getUsername()}"></td>
                                <td th:text="${admin.getPhone()}"></td>
                                <td th:text="${admin.getEmail()}"></td>
                                <td th:text="${admin.getRole()=='superAdmin'?'超级管理员':'普通管理员'}"></td>
                                <td class="td-status">
                                    <span class="layui-btn layui-btn-normal layui-btn-mini" th:text="${admin.getStatus()==1?'已启用':'未启用'}"></span></td>
                                <td class="td-manage">
                                    <a   title="启用" th:href="@{/admin/setStatus(ID=${admin.getId()})}">
                                        <i class="layui-icon" >&#xe601;</i>
                                    </a>
                                    <a title="编辑" th:href="@{/admin/toEdit(uid=${admin.getId()})}">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a title="删除" th:href="@{/admin/delAdmin(uid=${admin.getId()})}" >
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            <div>
                                <a class="prev" href="" th:href="@{/admin/allAdmin(pageNum=${adminPage.prePage})}">&lt;&lt;</a>
                                <span class="current" th:text="${adminPage.pageNum}">1</span>
                                <a class="next" href="" th:href="@{/admin/allAdmin(pageNum=${adminPage.nextPage})}">&gt;&gt;</a></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>layui.use(['laydate', 'form'],
    function() {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });


/*用户-删除*/
function member_del(obj, id) {
    layer.confirm('确认要删除吗？',
        function(index) {
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!', {
                icon: 1,
                time: 1000
            });
        });
}

function delAll(argument) {

    var data = tableCheck.getData();

    layer.confirm('确认要删除吗？' + data,
        function(index) {
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {
                icon: 1
            });
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
}</script>

</html>